package com.emser.unc.client.view;

import com.emser.unc.client.CloudMobile;
import com.emser.unc.client.resources.GlobalResources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;

public class MessageWView extends DialogBox{
	private final GlobalResources resource;
	private Button btnCancel, btnDelete;
	private Label lblMessageW;
	
	public MessageWView() {
		super(false);
		setSize("300px", "100px");
		
		FlexTable flexTable = new FlexTable();
		setWidget(flexTable);
		flexTable.setSize("100%", "100%");
		resource = GWT.create(GlobalResources.class);
		Image image = new Image(resource.getImageWarning());
		flexTable.setWidget(0, 0, image);
		flexTable.getCellFormatter().setHeight(0, 0, "34px");
		flexTable.getCellFormatter().setWidth(0, 0, "40px");
		
		lblMessageW = new Label("");
		lblMessageW.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		flexTable.setWidget(0, 1, lblMessageW);
		flexTable.getCellFormatter().setHeight(0, 1, "20px");
		flexTable.getCellFormatter().setWidth(0, 1, "250px");
		
		Grid grid = new Grid(1, 2);
		flexTable.setWidget(1, 1, grid);
	    grid.setSize("250px", "28px");
	    btnDelete = new Button(CloudMobile.constants.remove());
	    grid.setWidget(0, 0, btnDelete);
	    btnDelete.setSize("100px", "28px");
	    btnCancel = new Button(CloudMobile.constants.cancel());
	    grid.setWidget(0, 1, btnCancel);
	    btnCancel.setSize("100px", "28px");
	    grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
	    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
	    grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
	    grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
	    flexTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
	    flexTable.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
	    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
	    flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
	    setGlassEnabled(true);
	    center();
	}
	public Button getBtnCancel() {
		return btnCancel;
	}
	public Button getBtnDelete() {
		return btnDelete;
	}
	public HasText getLblMessageW() {
		return lblMessageW;
	}
}
